<?php

declare(strict_types=1);

namespace App\CustHub\Request;

use Mine\MineFormRequest;

class RoomInviteSchemeRequest extends MineFormRequest
{
    public function saveRules(): array
    {
        return [
            'target_room_type' => 'required|in:0,1,2',
            'target_room_config' => 'required',
            'room_member_limit' => 'required',
            'invite_rule' => 'required|in:0,1,2',
            'invite_interval' => 'required_if:invite_rule,0',
            'full_room_replacement' => 'required_if:invite_rule,2|in:0,1',
            'auto_create_room_switch' => 'required|in:0,1',
            'auto_create_room_config' => 'required_if:auto_create_room_switch,1',
            'resend_unjoined_switch' => 'required|in:0,1',
            'resend_unjoined_config' => 'required_if:resend_unjoined_switch,1',
            'resend_joined_switch' => 'required|in:0,1',
            'resend_joined_config' => 'required_if:resend_joined_switch,1',
            'exclude_existing_switch' => 'required|in:0,1',
            'exclude_historical_switch' => 'required|in:0,1',
        ];
    }

    public function updateRules(): array
    {
        return array_merge(['id' => 'required'], $this->saveRules());
    }


    public function getInfoRules(): array
    {
        return [
            'id' => 'required',
        ];
    }

    public function deleteRules(): array
    {
        return ['id' => 'required'];
    }

    public function getActiveRoomsRules(): array
    {
        return [
            'scheme_id' => 'required'
        ];
    }

    public function setActiveRoomStatusRules()
    {
        return [
            'scheme_id' => 'required',
            'robot_id' => 'required',
            'room_wxid' => 'required'
        ];
    }

    public function getRobotListByFixedMember():array
    {
        return [
            'fixed_member' => 'required'
        ];
    }

    public function changeStatus(): array
    {
        return [
            'id' => 'required',
            'status' => 'required|in:0,1'
        ];
    }
}